<script setup>
import types from "./controls/controls";

//组件的属性
defineProps({
    formData: {
        type: Object,
        default: {
            controls: [],
            props: {
                labelPosition: "right",
                labelWidth: 100,
                size: "default",
                customClass: "",
                cols: 12,
            }
        },
        required: true,
    },
    formModel: {
        type: Object,
        default: {},
        required: true,
    }
})

</script>

<template>
    <van-form>
        <van-cell-group>
            <component
                v-for="(element, index) in formData.controls"
                :key="index"
                :is="types[element.type].Viewer"
                :control="element"
                :model="formModel"
            />
        </van-cell-group>
    </van-form>
</template>


